package com.itcs.app.tran;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.alibaba.fastjson.JSON;
import com.itcs.redis.queue.RedisQueueTemplate;
import com.itcs.trading.model.TransJournal;

/**
 * 完成交易发送清算队列
 * 
 * @author LiuPeng
 * @date 2018年1月11日
 * 
 */
public class Send2ClearThread extends Thread {

	public final static String APP_TRAN_QUEUE = "itcs_app_tran_queue";

	private Log logger = LogFactory.getLog(getClass());

	private RedisQueueTemplate redisQueueTemplate;
	private TransJournal traderecord;

	public Send2ClearThread(RedisQueueTemplate redisQueueTemplate, TransJournal traderecord) {
		this.redisQueueTemplate = redisQueueTemplate;
		this.traderecord = traderecord;
	}

	@Override
	public void run() {
		try {
			redisQueueTemplate.rPush(APP_TRAN_QUEUE, JSON.toJSONString(traderecord));
		} catch (Exception e) {
			logger.error("发送车道完成交易信息到清算失败," + e.getMessage(), e);
		}
	}
}
